package com.xxx.video.main.activitys;

import android.os.Bundle;

import androidx.viewpager2.widget.ViewPager2;

import com.google.android.material.tabs.TabLayout;
import com.google.android.material.tabs.TabLayoutMediator;
import com.xxx.video.R;
import com.xxx.video.commen.activitys.BaseActivity;
import com.xxx.video.commen.utils.StatusBarUtil;
import com.xxx.video.main.adapters.MessagePagerAdapter;
import com.xxx.video.main.presenters.IMessageView;


import butterknife.BindView;

public class MessageActivity extends BaseActivity implements IMessageView {
    @BindView(R.id.tl_message_activity)
    TabLayout tlMessageActivity;
    @BindView(R.id.vp_message_activity)
    ViewPager2 vpMessageActivity;

    @Override
    public void initToolbarData() {
        super.initToolbarData();
        showActionBar();
        StatusBarUtil.getInstance().setStatusBarTransparent(this, true);
        setIsShowActionbarLine(true);
        setActionBarTitle(R.string.title_message_activity);
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_message;
    }

    @Override
    public void initData(Bundle extras) {
        showRootLayoutStatus(1);
        initTab();
    }

    @Override
    public void showRootLayoutStatus(int status) {
        showLayoutStatus(status);
    }

    @Override
    public void initTab() {
        MessagePagerAdapter rankingPagerAdapter = new MessagePagerAdapter(this);
        vpMessageActivity.setAdapter(rankingPagerAdapter);
        new TabLayoutMediator(tlMessageActivity, vpMessageActivity, (tab, position) -> {
            switch (position) {
                case 0:
                    tab.setText(R.string.tb_message_first);
                    break;
                default:
                    tab.setText(R.string.tb_message_second);
                    break;
            }

        }).attach();
    }
}
